﻿<!-- 成绩管理-成绩接收 -->
<style>
    .el-drawer__header {
        margin-bottom: 10px !important;
    }
</style>
<template>
    <div>
        <!-- 添加按钮 -->
        <div class="btn-add hide">
            <button type="button" class="btn btn-success btn-lg" @click="cjjs()"><i class="iconfont icon-chenggong ft12 mr5"></i>批量接收成绩</button>
            <button type="button" class="btn btn-danger btn-lg" @click="qxhf()"><i class="iconfont icon-chexiao ft12 mr5"></i>恢复权限</button>
        </div>
        <!-- 按条件选择 -->



        <div class="tab-filter-type ">

            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">学期</button>
                    </div>
                    <base-xq :pzoption="query.xq" isnow></base-xq>

                </div>
            </div>
            <div class="col-xs-3 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">班级系部</button>
                    </div>
                    <base-xb :pzoption="query.xb" isjx isqx></base-xb>

                </div>
            </div>
            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">课程类型</button>
                    </div>
                    <el-select placeholder="请选择课程类型" size="mini" v-model="query.kclx" class="form-control filter" style="height: 34px;padding:0px">
                        <el-option label="教学任务" value="教学任务"></el-option>
                        <el-option label="补考" value="补考"></el-option>
                    </el-select>

                </div>
            </div>

            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">输入情况</button>
                    </div>
                    <el-select placeholder="确认状态" size="mini" v-model="query.srzt" class="form-control filter" style="height: 34px;padding:0px">
                        <el-option label="全部" value="-1"></el-option>
                        <el-option label="未输入" value=""></el-option>
                        <el-option label="输入" value="输入"></el-option>
                        <el-option label="已提交" value="已提交"></el-option>
                        <el-option label="已接收" value="成绩已接收"></el-option>
                    </el-select>

                </div>
            </div>
        </div>

        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px">
            <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
            </base-table>
        </div>
        <!-- 表格 -->

        <el-dialog  title="成绩明细" :visible.sync="dialog"   width="70%">

            <div class="padding20" style="padding-top:0px;text-align:left;padding-bottom: 10px;">
                <!--<button type="button" class="btn btn-success btn-lg" @click="cjjs()"><i class="iconfont icon-chenggong ft12 mr5"></i>接收成绩</button>
    <button type="button" class="btn btn-danger btn-lg" @click="qxhf()"><i class="iconfont icon-chexiao ft12 mr5"></i>恢复权限</button>-->
                <el-button  type="success" @click="cjjs()" :loading="loading">{{ loading ? '提交中 ...' : '接收成绩' }}</el-button>
                <el-button  type="primary" @click="hfqx()" style="margin-left:15px">恢复权限</el-button>

                
            </div>
            <div class="row padding20" style="padding-top:10px;padding-bottom: 10px;">

                <div class="col-xs-4">
                    <div class="form-group">
                        <!--<label class="sr-only">Amount (in dollars)</label>-->
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color:#909399">班级</div>
                            <input type="text" class="form-control" v-model="nowdata.bj" disabled>
                        </div>
                    </div>
                </div>
                <div class="col-xs-4">
                    <div class="form-group">
                        <!--<label class="sr-only">Amount (in dollars)</label>-->
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color:#909399">课程名称</div>
                            <input type="text" class="form-control" disabled v-model="nowdata.kcmc">
                        </div>
                    </div>
                </div>
                <div class="col-xs-4">
                    <div class="form-group">
                        <!--<label class="sr-only">Amount (in dollars)</label>-->
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color:#909399">教师名称</div>
                            <input type="text" class="form-control" v-model="nowdata.jsmc" disabled>
                        </div>
                    </div>
                </div>
                <div class="hide">
                    <div class="col-xs-4">
                        <div class="form-group">
                            <!--<label class="sr-only">Amount (in dollars)</label>-->
                            <div class="input-group">
                                <div class="input-group-addon" style="background-color:#909399">学期</div>
                                <input type="text" class="form-control" disabled v-model="nowdata.xq">
                            </div>
                        </div>
                    </div>

                    <div class="col-xs-4">
                        <div class="form-group">
                            <!--<label class="sr-only">Amount (in dollars)</label>-->
                            <div class="input-group">
                                <div class="input-group-addon" style="background-color:#909399">课程类型</div>
                                <input type="text" class="form-control" v-model="nowdata.kclx" disabled>
                            </div>
                        </div>
                    </div>

                    <div class="col-xs-4">
                        <div class="form-group">
                            <!--<label class="sr-only">Amount (in dollars)</label>-->
                            <div class="input-group">
                                <div class="input-group-addon" style="background-color:#909399">成绩输入情况</div>
                                <input type="text" class="form-control" disabled v-model="nowdata.cjsrqk">
                            </div>
                        </div>
                    </div>

                </div>
             
            </div>
            <div style="padding:20PX;padding-top:0px;overflow:auto" >
                <base-table :pzoption="tableopcj" nocache>
                </base-table>
            </div>
        </el-dialog>

    </div>
</template>

<script>
const { debug } = require("console");

    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue'),
            'base-xq': httpVueLoader('/ViewV5/AppPage/QJJW/component/conxq.vue'),
            'base-xb': httpVueLoader('/ViewV5/AppPage/QJJW/component/conxb.vue?v=1')
        },
        data: function () {
            return {
                dialog: false,
                query: {
                    kclx: "教学任务",
                    srzt: "-1",
                    xq: { value: "" },
                    xb: { value: "" },
                },
                loading: false,
                js: { value: "" },
                ztdata: [],
                nowdata: {},
                tableopcj: {
                    title: "成绩明细",
                    issel: false,
                    iscz: false,
                    height: 350,
                    isxh: true,
                    dataset: [],
                    collist: [
                        { colid: "xm", colname: "姓名", isshow: true, istip: true },
                        { colid: "xh", colname: "学号", isshow: true, istip: true },
                        { colid: "bj", colname: "班级", isshow: true, istip: true },
                        { colid: "xklb", colname: "选课类别", isshow: false, istip: true },
                        { colid: "cpscj", colname: "平时成绩", isshow: true, istip: true },
                        { colid: "cqzcj", colname: "过程考核", isshow: true, istip: true },
                        { colid: "cqmcj", colname: "期末成绩", isshow: true, istip: true },
                        { colid: "kscj", colname: "总评成绩", isshow: true, istip: true },
                        { colid: "bklb", colname: "补考类别", isshow: true, istip: true }

                        //{ colid: "ksxzm", colname: "性质", isshow: true, istip: true },

                    ]
                },
                tableop: {
                    title: "教师成绩录入信息",
                    issel: false,
                    iscz: false,
                    height: 550,
                    isxh: true,
                    dataset: [],
                    multipleSelection: [],
                    czltabledata: [
                        {
                            colname: "成绩管理", bttype: "primary", isshow: true, mangefun: function (rowdata) {
                                var pro = this.$parent;
                                pro.nowdata = rowdata;
                                $.getJSON('/API/VIEWAPI.ashx?Action=CJGL_GETCJMXDATA', { P1: JSON.stringify(rowdata) }, function (resultData) {
                                    if (!resultData.ErrorMsg) {
                                        pro.dialog = true;
                                        pro.tableopcj.dataset = resultData.Result;
                                    }
                                })
                                //window.open("/ViewV5/AppPage/FORMBI/FormManage.html?vtype=0&piid=" + rowdata.ID, "_blank");
                            },
                        }
                    ],
                    collist: [
                        { colid: "kcmc", colname: "课程名称", isshow: true, istip: true },
                        { colid: "bj", colname: "班级", isshow: true, istip: true },
                        { colid: "jsmc", colname: "教师", isshow: true, istip: true },
                        { colid: "cjsrqk", colname: "成绩输入情况", isshow: true, istip: true },
                        { colid: "xq", colname: "学期", isshow: true, istip: true },
                        { colid: "kclx", colname: "课程类型", isshow: false, istip: true },
                        { colid: "kch", colname: "课程代码", isshow: false, istip: true }
                        //{ colid: "ksxzm", colname: "性质", isshow: true, istip: true },

                    ]
                }
            }
        },
        methods: {
            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            cjjs: function () {
                var pro = this;
                pro.loading = true;
                debugger;
                $.getJSON('/API/VIEWAPI.ashx?Action=CJGL_CJJS', { P1: JSON.stringify(pro.nowdata), P2: JSON.stringify(pro.tableopcj.dataset) }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.nowdata.cjsrqk = "成绩已接收";
                        pro.loading = false;
                        _.find(pro.tableop.dataset, function (obj) {
                            if (obj.kcmc == pro.nowdata.kcmc && obj.jsmc == pro.nowdata.jsmc && obj.bj == pro.nowdata.bj) {
                                obj.cjsrqk = "成绩已接收";
                            }
                        })
                    }
                })
            },
            hfqx: function () {
                var pro = this;
                $.getJSON('/API/VIEWAPI.ashx?Action=CJGL_CJHFQX', { P1: JSON.stringify(pro.nowdata) }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.nowdata.cjsrqk = "输入";
                        _.find(pro.tableop.dataset, function (obj) {
                            if (obj.kcmc == pro.nowdata.kcmc && obj.jsmc == pro.nowdata.jsmc && obj.bj == pro.nowdata.bj) {
                                obj.cjsrqk = "输入";
                            }
                        })

                    }
                })
            },
            cancelForm: function () {

            },
            querydata: function () {
                var pro = this;
                $.getJSON('/API/VIEWAPI.ashx?Action=CJGL_GETCJJSDATA', { xq: pro.query.xq.value, xbdm: pro.query.xb.value, kclx: pro.query.kclx, srzt: pro.query.srzt }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.tableop.dataset = resultData.Result;
                    }
                })

            },
            InitWigetData: function () {
                this.querydata();
            },
        },
        watch: {
            'query': { //深度监听，可监听到对象、数组的变化
                handler(newV, oldV) {
                    var chi = this;
                    if (newV) {
                        if (newV.xb.value) {
                            chi.querydata();
                        }

                    }
                },
                deep: true
            }
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        }
    };
</script>